﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SachOnlineLibrary.Public;
using SachOnlineLibrary.DAL;
using System.Data;
using System.Data.SqlClient;
namespace SachOnlineLibrary.BLL
{
    public class ThayDoiThongTinBLL
    {
        TaiKhoanDAL taikhoandal = new TaiKhoanDAL();
        TaiKhoanDAL thanhvienbll = new TaiKhoanDAL();
        public bool thaydoithongtincanhan(TaiKhoan thaydoi)
        {
            return taikhoandal.SuaTaiKhoan(thaydoi.TenTK, thaydoi.MatKhau, thaydoi.Ten, thaydoi.NgaySinh, thaydoi.Email, thaydoi.SoDT, thaydoi.DiaChi);
        }
        public List<TaiKhoan> LietKeTatCaThanhVien()
        {
            List<TaiKhoan> listthanhvien = new List<TaiKhoan>();
            DataTable dt = new DataTable();
            dt = thanhvienbll.LayDSTaiKhoan();
            foreach (DataRow dr in dt.Rows)
            {
                TaiKhoan thanhvien = new TaiKhoan();
                thanhvien.ChuyenDoi(dr);
                listthanhvien.Add(thanhvien);
            }
            return listthanhvien;
        }
    }
}
